do not do type checking based on pointer decorations in a public API
authorØyvind Kolås <ok@src.gnome.org>
Mon, 12 Jun 2006 19:33:06 +0000 (19:33 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Mon, 12 Jun 2006 19:33:06 +0000 (19:33 +0000)
ChangeLog
babl/babl-fish-reference.c
babl/babl-fish.c
babl/babl-memory.c
docs/index-static.html.in

index 118cdc862a231783b9e4361903a0606babcf33b7..da7b6f288e59f538754c37879a4ca9ace1a9b7e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-06-12  Øyvind Kolås  <pippin@gimp.org>
+
+       Do not expect the user to pass in BablImages (existance of babl
+       pointer decorations should not be allowed to be used to implement type
+       checking for provided buffers/bablimages)
+
+       * babl/babl-fish.c: (babl_fish_process):
+       * babl/babl-fish-reference.c: (babl_fish_reference_process):
+       * docs/index-static.html.in: removed section about planar BablImages
+       since the API is now disabled.
+
 2006-06-06  Øyvind Kolås  <pippin@gimp.org>
 
        Register all the formats that the gggl based conversions use in
index 88119a2df21f126aac6a9da92a3c6377251d3ba5..8acaab1e547a2d4fbf2f18e025abf0e7eea9a58d 100644 (file)
@@ -246,13 +246,14 @@ babl_fish_reference_process (Babl      *babl,
   if (BABL(babl->fish.source)->format.model ==
       BABL(babl->fish.destination)->format.model)
         return process_same_model (babl, source, destination, n); 
-  
+#if 0
   if (BABL_IS_BABL (source) ||
       BABL_IS_BABL (destination))
     {
       babl_log ("args=(%p, %p, %p, %li): trying to handle BablImage (unconfirmed code)",
                  babl_fish, source, destination, n);
     }
+#endif
 
   source_double_buf      = babl_malloc(sizeof (double) * n * 
                               BABL(babl->fish.source)->format.model->components);
@@ -269,8 +270,8 @@ babl_fish_reference_process (Babl      *babl,
 
   convert_to_double (
      (BablFormat*) BABL(babl->fish.source),
-     BABL_IS_BABL(source)?source:NULL,
-     BABL_IS_BABL(source)?NULL:source,
+     NULL,
+     source,
      source_double_buf,
      n
    );
@@ -323,8 +324,8 @@ babl_fish_reference_process (Babl      *babl,
   convert_from_double (
      (BablFormat*) BABL(babl->fish.destination),
      destination_double_buf,
-     BABL_IS_BABL(destination)?destination:NULL,
-     BABL_IS_BABL(destination)?NULL:destination,
+     NULL,
+     destination,
      n
    );
 
index 50737f362868441a789d402109e05426681e7729..8ced85749dd18de395a9e6d699a68f7e53836ecc 100644 (file)
@@ -144,13 +144,17 @@ babl_fish_process (Babl *babl,
       case BABL_FISH_SIMPLE:
       case BABL_FISH_PATH:
 
+#if 0
          if (BABL_IS_BABL (source))
            source_image = source;
+#endif
          if (!source_image)
            source_image = (BablImage*) babl_image_from_linear (
                                           source, (Babl*)babl->fish.source);
+#if 0
          if (BABL_IS_BABL (destination))
            destination_image = destination;
+#endif
          if (!destination_image)
            destination_image = (BablImage*) babl_image_from_linear (
                           destination, (Babl*)babl->fish.destination);
index 82719aeee2e8061c754d035bae8ff42b68a36dde..ec09ff24286609c9841c4e6615588134add02c51 100644 (file)
@@ -144,6 +144,7 @@ babl_free (void *ptr,
   if(!IS_BAI(ptr))
     babl_fatal ("memory not allocated by babl allocator");
   functions_sanity ();
+  BAI(ptr)->signature=NULL;
   free_f (BAI(ptr));
   frees++;
 }
index ff9313cbb54d1a5aaba4e6dcd06f89a8a02ceab7..f5e3cc8bf7550ff81f54eb6619e1196e3c95f36d 100644 (file)
                  <span class='function'>babl_component</span> <span class='paren'>(</span><span class='string'>"G'"</span><span class='paren'>)</span>,
                  <span class='function'>babl_component</span> <span class='paren'>(</span><span class='string'>"R'"</span><span class='paren'>)</span>,
                  <span class='NULL'>NULL</span><span class='paren'>);</span></pre>
-
+<!--
         <p>Instead of a linear buffer you can an image descriptor which desribes the start of the memory segment, the pitch in bytes between samples, and the rowstride (not used yet,
         use 0 to indicate unlimited for compatibility with future API.)
         </p>
                           <span class='NULL'>NULL</span><span class='paren'>)</span>,
                           pixel_count<span class='paren'>);</span>
 </pre>
+-->
 
         <a name='Extending'></a>
         <h2>Extending</h2>
         <a name='ColorManagement'></a>
         <h2>Color Management</h2>
         <p> Babl is not a color management system, since it doesn't deal with
-        ICC profiles. One way to deal with this is to register a custom color
-        model, that is backed by for instance <em>lcms</em>. (see the
-        <em>lcms-lab</em> extension) Then when using the newly registered color
-        model to create pixel formats, lcms will be used behind the scenes.
-        </p>
-        
+        ICC profiles. Babl is designed primarily for internal use when the
+        color space is already known (sRGB, CIE Lab, Luminance or similar).</p>
+
+        <p>
+        It is also possible to register new color models that are managed by a
+        color management system like <em>lcms</em>, take a look at the <em>lcms-lab</em>
+        extensions for an example.</p>
+
         <a name='TODO'></a>
         <h2>TODO</h2>
         
         <ul>
           <li>Validate that a created BablFishPath is actually faster than the
           BablFishReference it is a replacement for.</li>
-          <li>Compile-time instead of runtime profiling / storae of profiling
+          <li>Compile-time instead of runtime profiling / storage of profiling
           and loss data.. <em>(The speed of conversions
             is bound to 'wobble', according to architecture, compiler flags,
             concurrently running processes and phase of moon.)</em></li>
-          <li class='unstable'>Horizontal and vertical subsampling (for
-          implementing 4:2:2 4:2:0 4:1:1 etc. chroma subsampling)</li>
+          <li class='unstable'>Horizontal chroma subsampling (4:2:2 and 4:1:1)</li>
           <li>Thread safety (locking) for mutations of the type system.</li>
           <li>Support for datatypes that are not a multiple of 8bit.</li>
           <li>dithering</li>